import { DataSource } from 'typeorm';
// import { config } from 'dotenv';
import { User } from './user/entities/user.entity';
import { Job } from './job/entities/job.entity';
import { IdCard } from './id-card/entities/id-card.entity';
import { Tag } from './tag/entities/tag.entity';
import { City } from './city/entities/city.entity';

// config({ path: 'src/.env' });

// console.log(process.env);

export default new DataSource({
  type: 'mysql',
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: 'mysql1121',
  database: 'nest-study',
  synchronize: false,
  logging: true,
  // entities: ['src/**/**/*.entity.ts'],
  entities: [User, Job, IdCard, Tag, City],
  //
  poolSize: 10,
  migrations: ['./src/migration/**.ts'],
  connectorPackage: 'mysql2',
  extra: {
    authPlugin: 'sha256_password',
  },
});
